package cn.net.cfss.fgbp.api.console.constant;

import cn.net.cfss.fgbp.base.constant.BaseEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * 性别枚举
 *
 * @author yudeng
 * @since 2019-04-03
 */
public enum GenderEnum implements BaseEnum<GenderEnum, Integer> {

    MALE(0, "男"),
    FEMALE(1, "女"),
    UNKNOWN(2, "未知"),
    ;

    private Integer value;
    private String displayName;

    GenderEnum(Integer value, String displayName) {
        this.value = value;
        this.displayName = displayName;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    @Override
    public String getDisplayName() {
        return displayName;
    }

    private static Map<Integer, GenderEnum> enumMap = new HashMap<Integer, GenderEnum>();

    static {
        for (GenderEnum en : GenderEnum.values()) {
            enumMap.put(en.getValue(), en);
        }
    }

    public static GenderEnum getEnum(Integer value) {
        return enumMap.get(value);
    }
}
